{extend name="index/index" /}
{block name="main"}
<!-- Start of Page Container -->
<div class="page-container">
        <div class="container" style="margin: 36px auto;">
                <div class="row">
                        <!-- <div style="  margin: 8px 70px; font: bold 36px 雅黑;">
                            <h2>{$className}</h2>
                            <p style="margin:12px 26px;font-size: 16px;">发挥你的才能，他们都在等待你的帮助</p>
                        </div> -->

                        <!-- start of page content -->
                        <div class="span12 main-listing  answer-container" style="margin: 0 -8px;padding: 16px 91px;">

                                {volist name="data" id="v"}
                                <article class="format-standard type-post hentry clearfix" style="display: block;margin:12px -12px;padding: 6px 12px; border: 1px solid #ccc;border-radius: 5px;background: rgb(248,248,248);">

                                        <header class="clearfix">

                                                <h3 class="post-title" style="background: none;padding: 0;">
                                                        <img src="/static/upload/{$v['photo']}" width="60px" height="60px" style="display: inline-block;border-radius: 50%;height: 60px;" border="0">
                                                        <a href="{:url('index/question/read','id='.$v['id'])}">{$v['title']}</a>
                                                </h3>


                                                <div class="post-meta clearfix" style="margin-top: -20px;padding-left: 80px;">
                                                        <span class="date">{$v['time']}</span>
                                                        <span class="category"><a href="#" title="View all posts in Server &amp; Database">{$v['uname']}</a></span>
                                                        <span style="display: inline-block;text-align: left; float: right; width: 80px;">
                                                                <i class="laud icon-heart" url="{:url('index/question/likes')}" motion="question" qid="{$v['id']}" ></i>{$v['likes']}</span>
                                                </div><!-- end of post meta -->

                                        </header>

                                        <p style="padding-left:16px; line-height: 25px; font-family: serif; font-size: 14px; color: #666;">{$v['content']}</p>
                                        <a style="display: none; float: right;"  class="card__link card__readmore showContent">展开内容</a>
                                        <div class="card__meta">
                                                <a href="{:url('index/question/read','id='.$v['id'])}"><span class="card__meta-label card__meta-comments">我来回答</span></a>
                                                
                                        </div>

                                </article>
                                {/volist}


                                <div id="pagination">
                                        <a href="{:url('index/index/index',['page'=>(max($page-1,1))])}" class="btn">上页 »</a>
                                        {for start="1" end="$count+1"}
                                        <a href="{:url('index/index/index',['page'=>$i])}" class="btn {:$page==$i?'active':''}">{$i}</a>
                                        {/for}
                                        <a href="{:url('index/index/index',['page'=>(min($page+1,ceil($count/10)))])}" class="btn">下页 »</a>
                                </div>


                        </div>
                        <!-- end of page content -->


                </div>
        </div>
</div>
<!-- End of Page Container -->
<script type="text/javascript">
        
      $('.laud').click(function (){
            var str = $(this).attr('motion') == "question" ? '收藏' : '点赞' ;
            $.ajax({
                type: 'post',
                data: {
                        "qid":$(this).attr('qid'),
                        "aid":$(this).attr('aid'),
                        "motion":$(this).attr('motion')
                      },
                url: $(this).attr('url'),
                success: function (data) {
                        console.log(data);
                        if (data == '已存在') {
                          alert('您已'+str+'过，无需重复操作');
                          return;
                        }else if(data != 1){
                          alert('操作失败，请重试');
                          return;
                        }
                        // location = location;
                },
                error: function () {
                    alert('执行失败，请重试');
                }
            });
      });

</script>
{/block}